/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tomica.datarespone;

import iaik.pkcs.pkcs11.TokenInfo;
import iaik.pkcs.pkcs11.Version;
import iaik.pkcs.pkcs11.wrapper.PKCS11Constants;
import java.util.Date;
import tomica.utils.TomicaUtils;

/**
 *
 * @author Tran
 */
public class DataResponse_C_GetTokenInfo {
    private long responseCode;
    
 
  
	/**
	 * The label of this token.
	 */
	protected String label;

	/**
	 * The identifier of the manufacturer of this token.
	 */
	protected String manufacturerID;

	/**
	 * The model of this token.
	 */
	protected String model;

	/**
	 * The serial number of this token.
	 */
	protected String serialNumber;

	/**
	 * The maximum number of concurrent (open) sessions.
	 */
	protected long maxSessionCount;

	/**
	 * The current number of open sessions.
	 */
	protected long sessionCount;

	/**
	 * Maximum number of concurrent (open) read-write sessions.
	 */
	protected long maxRwSessionCount;

	/**
	 * The current number of open read-write sessions.
	 */
	protected long rwSessionCount;
	/**
	 * The maximum PIN length that this token allows.
	 */
	protected long maxPinLen;

	/**
	 * The minimum PIN length that this token allows.
	 */
	protected long minPinLen;

	/**
	 * The total amount of memory for public objects on this token.
	 */
	protected long totalPublicMemory;

	/**
	 * The amount of free memory for public objects on this token.
	 */
	protected long freePublicMemory;

	/**
	 * The total amount of memory for private objects on this token.
	 */
	protected long totalPrivateMemory;

	/**
	 * The amount of free memory for private objects on this token.
	 */
	protected long freePrivateMemory;

	/**
	 * The version of the hardware of this token.
	 */
        protected byte hardwareVmajor;
        protected byte hardwareVminor;

	/**
	 * The version of the firmware of this token.
	 */
        protected byte firmwareVmajor;
        protected byte firmwareVminor;

	/**
	 * The current time on the token. This value only makes sense, if the token
	 * contains a clock.
	 */
	protected String time;

	/**
	 * True, if the token has a random numebr generator.
	 */
	protected boolean rng;

	/**
	 * True, if the token is write protected.
	 */
	protected boolean writeProtected;

	/**
	 * True, if the token requires the user to login to perform certain
	 * operations.
	 */
	protected boolean loginRequired;

	/**
	 * True, if the user-PIN is already initialized.
	 */
	protected boolean userPinInitialized;

	/**
	 * True, if a successful save of a sessions cryptographic operations state
	 * always contains all keys needed to restore the state of the session.
	 */
	protected boolean restoreKeyNotNeeded;

	/**
	 * True, if the token has a clock.
	 */
	protected boolean clockOnToken;

	/**
	 * True, if there are different means to authenticate the user than passing
	 * the user-PIN to a login operation.
	 */
	protected boolean protectedAuthenticationPath;

	/**
	 * True, if the token supports dual crypto operations.
	 */
	protected boolean dualCryptoOperations;

	/**
	 * True, if the token is already initialized.
	 */
	protected boolean tokenInitialized;

	/**
	 * True, if the token supports secondary authentication for private key
	 * objects.
	 */
	protected boolean secondaryAuthentication;

	/**
	 * True, if the user-PIN has been entered incorrectly at least once since the
	 * last successful authentication.
	 */
	protected boolean userPinCountLow;

	/**
	 * True, if the user has just one try left to supply the correct PIN before
	 * the user-PIN gets locked.
	 */
	protected boolean userPinFinalTry;

	/**
	 * True, if the user-PIN is locked.
	 */
	protected boolean userPinLocked;

	/**
	 * True, if the user PIN value is the default value set by token initialization
	 * or manufacturing.
	 */
	protected boolean userPinToBeChanged;

	/**
	 * True, if the security officer-PIN has been entered incorrectly at least
	 * once since the last successful authentication.
	 */
	protected boolean soPinCountLow;

	/**
	 * True, if the security officer has just one try left to supply the correct
	 * PIN before the security officer-PIN gets locked.
	 */
	protected boolean soPinFinalTry;

	/**
	 * True, if the security officer-PIN is locked.
	 */
	protected boolean soPinLocked;

	/**
	 * True, if the security officer-PIN value is the default value set by token
	 * initialization or manufacturing.
	 */
	protected boolean soPinToBeChanged;

    public DataResponse_C_GetTokenInfo() {
    }

    public long getResponseCode() {
        return responseCode;
    }

    public void setResponseCode(long responseCode) {
        this.responseCode = responseCode;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getManufacturerID() {
        return manufacturerID;
    }

    public void setManufacturerID(String manufacturerID) {
        this.manufacturerID = manufacturerID;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getSerialNumber() {
        return serialNumber;
    }

    public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }

    public long getMaxSessionCount() {
        return maxSessionCount;
    }

    public void setMaxSessionCount(long maxSessionCount) {
        this.maxSessionCount = maxSessionCount;
    }

    public long getSessionCount() {
        return sessionCount;
    }

    public void setSessionCount(long sessionCount) {
        this.sessionCount = sessionCount;
    }

    public long getMaxRwSessionCount() {
        return maxRwSessionCount;
    }

    public void setMaxRwSessionCount(long maxRwSessionCount) {
        this.maxRwSessionCount = maxRwSessionCount;
    }

    public long getRwSessionCount() {
        return rwSessionCount;
    }

    public void setRwSessionCount(long rwSessionCount) {
        this.rwSessionCount = rwSessionCount;
    }

    public long getMaxPinLen() {
        return maxPinLen;
    }

    public void setMaxPinLen(long maxPinLen) {
        this.maxPinLen = maxPinLen;
    }

    public long getMinPinLen() {
        return minPinLen;
    }

    public void setMinPinLen(long minPinLen) {
        this.minPinLen = minPinLen;
    }

    public long getTotalPublicMemory() {
        return totalPublicMemory;
    }

    public void setTotalPublicMemory(long totalPublicMemory) {
        this.totalPublicMemory = totalPublicMemory;
    }

    public long getFreePublicMemory() {
        return freePublicMemory;
    }

    public void setFreePublicMemory(long freePublicMemory) {
        this.freePublicMemory = freePublicMemory;
    }

    public long getTotalPrivateMemory() {
        return totalPrivateMemory;
    }

    public void setTotalPrivateMemory(long totalPrivateMemory) {
        this.totalPrivateMemory = totalPrivateMemory;
    }

    public long getFreePrivateMemory() {
        return freePrivateMemory;
    }

    public void setFreePrivateMemory(long freePrivateMemory) {
        this.freePrivateMemory = freePrivateMemory;
    }

    public byte getHardwareVmajor() {
        return hardwareVmajor;
    }

    public void setHardwareVmajor(byte hardwareVmajor) {
        this.hardwareVmajor = hardwareVmajor;
    }

    public byte getHardwareVminor() {
        return hardwareVminor;
    }

    public void setHardwareVminor(byte hardwareVminor) {
        this.hardwareVminor = hardwareVminor;
    }

    public byte getFirmwareVmajor() {
        return firmwareVmajor;
    }

    public void setFirmwareVmajor(byte firmwareVmajor) {
        this.firmwareVmajor = firmwareVmajor;
    }

    public byte getFirmwareVminor() {
        return firmwareVminor;
    }

    public void setFirmwareVminor(byte firmwareVminor) {
        this.firmwareVminor = firmwareVminor;
    }

    

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public boolean isRng() {
        return rng;
    }

    public void setRng(boolean rng) {
        this.rng = rng;
    }

    public boolean isWriteProtected() {
        return writeProtected;
    }

    public void setWriteProtected(boolean writeProtected) {
        this.writeProtected = writeProtected;
    }

    public boolean isLoginRequired() {
        return loginRequired;
    }

    public void setLoginRequired(boolean loginRequired) {
        this.loginRequired = loginRequired;
    }

    public boolean isUserPinInitialized() {
        return userPinInitialized;
    }

    public void setUserPinInitialized(boolean userPinInitialized) {
        this.userPinInitialized = userPinInitialized;
    }

    public boolean isRestoreKeyNotNeeded() {
        return restoreKeyNotNeeded;
    }

    public void setRestoreKeyNotNeeded(boolean restoreKeyNotNeeded) {
        this.restoreKeyNotNeeded = restoreKeyNotNeeded;
    }

    public boolean isClockOnToken() {
        return clockOnToken;
    }

    public void setClockOnToken(boolean clockOnToken) {
        this.clockOnToken = clockOnToken;
    }

    public boolean isProtectedAuthenticationPath() {
        return protectedAuthenticationPath;
    }

    public void setProtectedAuthenticationPath(boolean protectedAuthenticationPath) {
        this.protectedAuthenticationPath = protectedAuthenticationPath;
    }

    public boolean isDualCryptoOperations() {
        return dualCryptoOperations;
    }

    public void setDualCryptoOperations(boolean dualCryptoOperations) {
        this.dualCryptoOperations = dualCryptoOperations;
    }

    public boolean isTokenInitialized() {
        return tokenInitialized;
    }

    public void setTokenInitialized(boolean tokenInitialized) {
        this.tokenInitialized = tokenInitialized;
    }

    public boolean isSecondaryAuthentication() {
        return secondaryAuthentication;
    }

    public void setSecondaryAuthentication(boolean secondaryAuthentication) {
        this.secondaryAuthentication = secondaryAuthentication;
    }

    public boolean isUserPinCountLow() {
        return userPinCountLow;
    }

    public void setUserPinCountLow(boolean userPinCountLow) {
        this.userPinCountLow = userPinCountLow;
    }

    public boolean isUserPinFinalTry() {
        return userPinFinalTry;
    }

    public void setUserPinFinalTry(boolean userPinFinalTry) {
        this.userPinFinalTry = userPinFinalTry;
    }

    public boolean isUserPinLocked() {
        return userPinLocked;
    }

    public void setUserPinLocked(boolean userPinLocked) {
        this.userPinLocked = userPinLocked;
    }

    public boolean isUserPinToBeChanged() {
        return userPinToBeChanged;
    }

    public void setUserPinToBeChanged(boolean userPinToBeChanged) {
        this.userPinToBeChanged = userPinToBeChanged;
    }

    public boolean isSoPinCountLow() {
        return soPinCountLow;
    }

    public void setSoPinCountLow(boolean soPinCountLow) {
        this.soPinCountLow = soPinCountLow;
    }

    public boolean isSoPinFinalTry() {
        return soPinFinalTry;
    }

    public void setSoPinFinalTry(boolean soPinFinalTry) {
        this.soPinFinalTry = soPinFinalTry;
    }

    public boolean isSoPinLocked() {
        return soPinLocked;
    }

    public void setSoPinLocked(boolean soPinLocked) {
        this.soPinLocked = soPinLocked;
    }

    public boolean isSoPinToBeChanged() {
        return soPinToBeChanged;
    }

    public void setSoPinToBeChanged(boolean soPinToBeChanged) {
        this.soPinToBeChanged = soPinToBeChanged;
    }

    

    public void setTokenInfor(TokenInfo toCGetTokenInfor) {
        setFirmwareVersion(toCGetTokenInfor.getFirmwareVersion());
        setHardwareVersion(toCGetTokenInfor.getHardwareVersion());
        setFreePrivateMemory(toCGetTokenInfor.getFreePrivateMemory());
        setFreePublicMemory(toCGetTokenInfor.getFreePublicMemory());
        setLabel(toCGetTokenInfor.getLabel());
        System.out.println("label: "+toCGetTokenInfor.getLabel());
        setManufacturerID(toCGetTokenInfor.getManufacturerID());
        setMaxPinLen(toCGetTokenInfor.getMaxPinLen());
        setMaxRwSessionCount(toCGetTokenInfor.getMaxRwSessionCount());
        setMaxSessionCount(toCGetTokenInfor.getMaxSessionCount());
        setMinPinLen(toCGetTokenInfor.getMinPinLen());
        System.out.println("setMinPinLen: "+toCGetTokenInfor.getMinPinLen());
        setModel(toCGetTokenInfor.getModel());
        setRwSessionCount(toCGetTokenInfor.getRwSessionCount());
        setSerialNumber(toCGetTokenInfor.getSerialNumber());
        setSessionCount(toCGetTokenInfor.getSessionCount());
        setTime(/*TomicaUtils.convertDateToString(toCGetTokenInfor.getTime())*/"aaa");
        setTotalPrivateMemory(toCGetTokenInfor.getTotalPrivateMemory());
        setTotalPublicMemory(toCGetTokenInfor.getTotalPublicMemory());
    }

    private void setFirmwareVersion(Version firmwareVersion) {
        setFirmwareVmajor(firmwareVersion.getMajor());
        setFirmwareVminor(firmwareVersion.getMinor());
    }

    private void setHardwareVersion(Version hardwareVersion) {
        setHardwareVmajor(hardwareVersion.getMajor());
        setHardwareVminor(hardwareVersion.getMinor());
    } 
        
        
        
    
}
